#/bin/sh # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Desktop Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description - Script to change user password and update keychain # Parameters - "" "" "" # Configuration Type - COMPUTER if [ $# == '3' ]; then username=$1 oldpwd=$2 newpwd=$3 dscl . -passwd /Users/"$username" $oldpwd $newpwd security set-keychain-password -o $oldpwd -p $newpwd "/Users/$username/Library/Keychains/login.keychain" ret=$? if [ $ret == "0" ]; then echo "Password Changed Successfully" else echo "Error in Changing Password" fi exit $ret else echo "Invalid Arguments - Please refer description of Script" exit 1 fi